//
//  LoadingViewController.m
//  PropertyPayment
//
//  Created by 高文富 on 14-4-10.
//  Copyright (c) 2014年 高文富. All rights reserved.
//

#import "LoadingViewController.h"
#import "AppDelegate.h"
#import "LoginViewController.h"
#define  time 5

@interface LoadingViewController (){
   
    NSTimer *timer;
    NSInteger num;
}
@property (weak, nonatomic) IBOutlet UILabel *goLoginLab;

@end

@implementation LoadingViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
   
//    num=5;
//    
//    _goLoginLab.text=[NSString stringWithFormat:@"跳转%ld",num];
//    //_pageBtn.pageIndicatorTintColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"selected_purple.png"]];
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
//    float screenHeight=[UIScreen mainScreen].bounds.size.height;
//    
//    if (screenHeight>700) {
//        
//        CGRect startBtnFrame=_startBtn.frame;
//        startBtnFrame.origin.y-=25;
//        _startBtn.frame=startBtnFrame;
//        
//    }else if(screenHeight>600) {
//        
//        CGRect startBtnFrame=_startBtn.frame;
//        startBtnFrame.origin.y-=15;
//        _startBtn.frame=startBtnFrame;
//        
//    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)clearAllClick:(UIButton *)sender {

    
    AppDelegate *appdelegate=(AppDelegate *)[[UIApplication sharedApplication]delegate];
    
   
    CATransition *animation = [CATransition animation];
    animation.type = kCATransitionFromRight;
    animation.subtype = kCATransitionPush;
    animation.duration = 0.25;
    [appdelegate.window.layer addAnimation:animation forKey:nil];
    
    appdelegate.window.rootViewController=[isLogin storeBordName:@"Main" :@"LoginViewController"];
    //登录之后然后进入首页
    
    // RootViewController * root =[[RootViewController alloc]init];
    // self.window.rootViewController = root;
    
}


- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
{
  _pageBtn.currentPage = scrollView.contentOffset.x/scrollView.frame.size.width;
 
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
     _pageBtn.currentPage = scrollView.contentOffset.x/scrollView.frame.size.width;
    if (_pageBtn.currentPage==2) {
   
//        timer=[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(goLoginVC:) userInfo:nil repeats:time];
        
//         _goLoginLab.hidden=NO;
        _startBtn.hidden=NO;
    }else{
//        num=5;
//        
//        _goLoginLab.hidden=YES;
//        if (timer!=nil) {
//            [timer invalidate];
//            timer=nil;
//        }
        _startBtn.hidden=YES;
    }
}
- (void)goLoginVC:(NSTimer *)currTimer
{
//    timer=currTimer;
//    num--;
//    
//    _goLoginLab.text=[NSString stringWithFormat:@"跳转%ld",num];
//    if ([_goLoginLab.text isEqualToString:@"跳转0"] && num==0) {
//         [timer invalidate];
//        
//        [self performSelector:@selector(goWelcame) withObject:self afterDelay:1.0f];
//        
//        
//    }


}


@end
